package models

import (
	"fmt"
	"github.com/go-redis/redis"
	"main1/conf"
)

var (
	RedisDB *redis.Client
)

func RedisInit() {
	configs := conf.Config.RedisConfig
	RedisDB = redis.NewClient(&redis.Options{

		Addr:     configs.Addr,
		Password: configs.Password,
		DB:       configs.DB,
	})
	err = RedisDB.Ping().Err()
	if err != nil {
		fmt.Println("redis连接失败")
		return
	} else {
		fmt.Println("redis连接成功")
	}
}
